
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Sentinel如何在分布式环境中实现集群限流的？ - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Sentinel如何在分布式环境中实现集群限流的？ - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Sentinel 在分布式环境中实现集群限流的核心机制是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">核心机制是通过使用分布式协调组件（如 Redis 或 Zookeeper）来实现流量控制规则的分布式同步和数据共享，从而确保各个服务实例遵循一致的限流规则。</div>
          </div>
          <div class="card-source">来源: 文档引言第二段</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">原理</div>
          <div class="card-question">Sentinel 集群限流主要基于哪两个基本原理？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">原理</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">主要基于两个原理：1. 流量控制，即设置基于 QPS 或响应时间等指标的限流规则；2. 集群模式，使不同服务实例能够协同工作，共同遵守限流规则。</div>
          </div>
          <div class="card-source">来源: Sentinel 集群限流的原理</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在 Sentinel 的集群模式下，当限流规则发生变化时，系统如何保证所有实例都能应用新规则？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通过规则传播机制。当规则发生变化时，这些变化会被传播到集群中的所有实例，确保每个实例都遵循相同的最新限流规则。</div>
          </div>
          <div class="card-source">来源: Sentinel 集群限流的实现步骤</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">列举使用 Sentinel 集群限流的三个主要优势。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">主要优势包括：1. 全局流量控制，避免单个服务实例过载导致系统崩溃；2. 灵活配置，支持 QPS 限流、并发线程数限制等多种策略；3. 容错与恢复，能在服务负载过高时自动进行熔断和降级。</div>
          </div>
          <div class="card-source">来源: Sentinel 集群限流的优势</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">Sentinel 可以利用哪些常见的外部组件来实现数据共享与同步？请举例说明其作用。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Sentinel 可以使用 Redis 或 Zookeeper 等分布式协调组件。例如，当使用 Redis 时，Sentinel 可以将流量控制规则和实时的流量数据存储到 Redis 中，所有实例都可以从中获取最新的规则和指标。</div>
          </div>
          <div class="card-source">来源: Sentinel 集群限流的实现步骤</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">除了执行限流规则，Sentinel 还提供了什么重要功能来帮助开发者管理集群的流量状态？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Sentinel 提供了实时监控功能。通过控制台或监控系统，开发者可以查看各个服务实例的流量数据和限流状态，从而监控整个集群的流量情况并进行相应调整。</div>
          </div>
          <div class="card-source">来源: Sentinel 集群限流的实现步骤</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
